# Python 2.6.4
# Project Euler, Problem 22
# Copyright 2010 Talha Zaman

f = open("names.txt")
names = f.readline().strip('"').split('","')
f.close()
names.sort()

total = 0
for i in range(0, len(names)):
    total += (i+1) * sum([ord(j)-64 for j in names[i]])
print total
